package com.block.storage.factory;

import com.block.common.util.ApplicationContextUtil;
import com.block.storage.enums.OssTypeEnum;
import com.block.storage.service.IOssService;
import com.block.storage.service.oss.OssAliService;

import java.util.HashMap;
import java.util.Map;

public class OssFactory {

    private static Map<String, Class<? extends IOssService>> serviceMap = new HashMap<>();
    static {

        serviceMap.put(OssTypeEnum.ALIYUN.getType(), OssAliService.class);

    }


    public static IOssService getService(String ossType){
        if (serviceMap.containsKey(ossType)){
            Class<? extends IOssService> aClass = serviceMap.get(ossType);
            return ApplicationContextUtil.getBean(aClass);
        }
        return null;
    }


}
